package cn.edu.java.stream.C终结操作;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class collectDemo {
    public static void main(String[] args) {
        List<String> fruits = Arrays.asList("apple", "banana", "orange", "orange");
        List<String> stringList = fruits.stream().collect(Collectors.toList());
        System.out.println(stringList);

        Set<String> stringSet = fruits.stream().collect(Collectors.toSet());
        System.out.println(stringSet);

        Map<String, String> stringMap = fruits.stream().distinct().collect(Collectors.toMap(String::toLowerCase, String::toUpperCase));
        System.out.println(stringMap);
    }
}
